package com.example.child_protection.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 属性值类型枚举
 * @author Biz
 * @date 2018-10-31
 */
public enum AttrTypeEnums {

    TEXT("TEXT", "文本框"),

    DATE("DATE", "日期控件"),

    DATETIME("DATETIME", "时间控件"),

    SELECT("SELECT", "下拉列表"),

    RADIO("RADIO", "单选按钮"),

    TEXTAREA("TEXTAREA", "文本域"),

    CHECKBOX("CHECKBOX", "多选按钮"),

    SELECT_TEXT("SELECT_TEXT", "可编辑的下拉列表")

    ;

    private final String value;

    private final String displayName;

    private static Map<String, AttrTypeEnums> valueMap;

    private AttrTypeEnums(String value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    public AttrTypeEnums getEnum(String value) {
        return (AttrTypeEnums) valueMap.get(value);
    }

    public Map<String, AttrTypeEnums> getAllValueMap() {
        return valueMap;
    }

    public String getValue() {
        return this.value;
    }

    public String getDisplayName() {
        return this.displayName;
    }

    static {

        valueMap = new HashMap<String, AttrTypeEnums>();

        for (AttrTypeEnums e : values())
            valueMap.put(e.value, e);
    }
}
